


var ranking = {
    tpl:function(title,data){
        return '<div class="ranking-article">' +
            '    <div class="hd">' +
            '        <!--<a target="_blank" href="../article/index-type=recommend.html">更多</a>-->' +
            '        <span>'+ title +'</span>' +
            '    </div>' +
            '    <div class="bd">' +
            '        <ul>' +
                (function () {
                    var liHtml= ""

                    for(var i = 0; i<data.length; i++){
                        liHtml += '<li> <span>'+data[i].date+'</span><a target="_blank" href="'+ data[i].href +'">'+ data[i].title +'</a></li>'
                    }

                    return liHtml
                })()
            +'        </ul>' +
            '    </div>' +
            '</div>'
    },
    init:function (opt) {
        var self = this
        $.get(opt.url).done(function(){
            opt.container.append(self.tpl(opt.title,opt.data))
        })
    }
}